package com.qfedu.service;

import com.qfedu.dao.AdminDao;
import com.qfedu.entity.Admin;
import com.qfedu.entity.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService{

    @Autowired
    private AdminDao adminDao;

    @Override
    public ResponseData<List<Admin>> logIn(Admin admin) {
        ResponseData<List<Admin>> responseData = new ResponseData<>();
        Admin result = adminDao.logIn(admin);
        if (result != null) {
            responseData.setCode(1);
            responseData.setMsg("登录成功");
        } else {
            responseData.setCode(0);
            responseData.setMsg("账号或密码错误");
        }

        return responseData;
    }
}
